﻿/*  
	------------------------------------------------------------------------
	 NQ Core Library
	
	 Homepage: http://www.awzhome.de/
	------------------------------------------------------------------------
	
	This Source Code Form is subject to the terms of the Mozilla Public
	License, v. 2.0. If a copy of the MPL was not distributed with this
	file, You can obtain one at http://mozilla.org/MPL/2.0/.
   
	The Original Code is code of NQ Core Library.

	The Initial Developer of the Original Code is Andreas Weizel.
	Portions created by the Initial Developer are
	Copyright (C) 2012 Andreas Weizel. All Rights Reserved.
	
	Contributor(s): (none)
	
	------------------------------------------------------------------------
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AWZhome.NQ.Core;

namespace AWZhome.NQ.ConsoleHost
{
	static class StartUp
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		public static void Main(string[] args)
		{
			// Initializing of NQ service manager
			NQServiceManagerImpl servman = new NQServiceManagerImpl(args, NQHostMode.Console);
			NQServiceManager.SetImplementation(servman);
#if !DEBUG
			try
			{
#endif
				// Load all components in plugin directory
				servman.LoadComponents();
				servman.LoadServices();
#if !DEBUG
			}
			catch (Exception ex)
			{
				// Output exception
				Console.WriteLine(ex.ToString());
			}
			finally
			{
#endif
				servman.DestroyServices();
#if !DEBUG
			}
#endif
		}
	}
}
